<html xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui" >  

    <ui:composition template="layout.xhtml">-->

        <ui:define name="corpo">
            <h:form id="index_form" acceptcharset="utf-8"> 
                <p:panel header="Principal - Entrada de Selos">

                    <br/>
                    <h:panelGrid style="float: right;" columns="4">
                        <p:graphicImage url="/media/img/new.png" title="Cadastrar Entrada Selo" /> <p:commandLink   value="Cadastrar" title="Cadastrar Entrada Selo" actionListener="#{managerEntrada.criarEntradaSelo()}" update="@form"/>
                        <!--                        <p:graphicImage url="/media/img/search.png" title="Pesquisar Entrada Selo"/><p:commandLink value="Pesquisar" title="Pesquisar Entrada Selo" actionListener="{managerEntrada.pesquisarEntradaSelo()}" update="@form"/>-->
                    </h:panelGrid>
                    <br/>
                    <br/> 
                    <p:dataTable id="entradaTable" var="entrada" value="#{managerEntrada.listarEntradaSelo()}" 
                                 paginator="true" rows="5"
                                 paginatorPosition="bottom"
                                 paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}"  
                                 rowsPerPageTemplate="5,10,15">  

                        <f:facet name="header">  
                            Ultimas Entradas de Selos
                        </f:facet>
                        <p:column style="width:4%">  
                            <p:rowToggler />  
                        </p:column>  
                        <p:column style="width:50px;">  
                            <f:facet name="header" >   
                                N° Nota
                            </f:facet>  
                            <h:outputText value="#{entrada.numeroNota}" />  
                        </p:column>
                        <p:column style="width:300px;">  
                            <f:facet name="header" >   
                                Fornecedor
                            </f:facet>  
                            <h:outputText value="#{entrada.fornecedor.nome}" />  
                        </p:column>
                        <p:column style="width:400px;">  
                            <f:facet name="header" >   
                                Detalhes da Entrada
                            </f:facet> 
                            <ui:repeat value="#{entrada.listDetalhe}" var="tra" >
                                <h:outputText value=" #{tra.tipoSelo.nome}, "/>
                            </ui:repeat> 
                        </p:column>
                        <p:column style="width:100px;">  
                            <f:facet name="header" >   
                                Data Entrada
                            </f:facet>  
                            <h:outputText value="#{entrada.dataEntrada}">
                                <f:convertDateTime pattern="dd/MM/yyyy HH:mm:ss"/>
                            </h:outputText>
                        </p:column>
                        <p:rowExpansion>                        
<!--                            <ul>                                
                            <ui:repeat value="#{entrada.listDetalhe}" var="tra" >
                                <li>
                                    <h:outputText value="Tipo Selo:" style="font-weight: bold;"/>
                                    <h:outputText value=" #{tra.tipoSelo.nome}, "/>
                                    <h:outputText value=" Preço R$:" style="font-weight: bold;"/>
                                    <h:outputText value=" #{tra.preco}, "/>
                                    <h:outputText value=" Serie :" style="font-weight: bold;"/>
                                    <h:outputText value=" #{tra.serie}"/>
                                    <h:outputText value=" - Quantidade :" style="font-weight: bold;"/>
                                    <h:outputText value=" #{tra.qtd}"/>
                                    <h:outputText value=" - Num Inicial :" style="font-weight: bold;"/>
                                    <h:outputText value=" #{tra.numIni}"/>                                    
                                    <h:outputText value=" - Num Final :" style="font-weight: bold;"/>
                                    <h:outputText value=" #{tra.numFim}"/>
                                </li>
                            </ui:repeat>
                            </ul>-->
                            
                            <p:dataGrid columns="4" var="tra" value="#{entrada.listDetalhe}" 
                                        rows="4" paginator="true" paginatorPosition="bottom"
                                         
                                    >  
                                    <p:panel header="#{tra.tipoSelo.nome}" style="text-align:center; max-width: 250px; float:left;">  
                                        <h:panelGrid columns="2" style="float: left;" >  
                                            <h:outputText value=" Preço R$:" style="font-weight: bold;"/>
                                            <h:outputText value=" #{tra.preco}"/>
                                            <h:outputText value=" Serie :" style="font-weight: bold;"/>
                                            <h:outputText value=" #{tra.serie}"/> 
                                            <h:outputText value=" Num. Inicial :" style="font-weight: bold; width: 60px;"/>
                                            <h:outputText value=" #{tra.numIni}" style=" width: 60px;"/> 
                                            <h:outputText value=" Num. Final :" style="font-weight: bold; width: 60px;"/>
                                            <h:outputText value=" #{tra.numFim}" /> 
                                        </h:panelGrid>  
                                    </p:panel>  
                                </p:dataGrid>  
                            
                            
                        </p:rowExpansion>
                        <p:column style="width:80px;">  
                            <f:facet name="header">  
                                <h:outputText value="Opções" />   
                            </f:facet>
                            <p:commandButton  icon="editar" actionListener="#{managerEntrada.editarEntrada(entrada)}" update="@form"/> 
                            <!--                            <p:commandButton  icon="view" actionListener="{managerPessoa.visualizarPessoa(pessoa)}" update="@form"/>   -->

                        </p:column>

                    </p:dataTable> 





                </p:panel>
            </h:form>
        </ui:define>
    </ui:composition>
</html>